<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019\6\15 0015
 * Time: 17:06
 */

namespace BigVideo\IMooc\Evrnt;

/**
 * 观察者模式
 * Class Test
 * @package BigVideo\IMooc\Evrnt
 */
class Test
{
    public function index(Event $event){
        echo "某件事做完后<br/>\n";
        $event->notify();
    }
}

/**
 * 观察者模式调用   用于观察某件事完成后做的相关动作
 */
$test = new Test();
$event = new Event();
$event->addObserver(new Observer1());
$event->addObserver(new Observer2());
$test->index($event);